import re


def compare_version(version1: str, version2: str) -> int:
    """
    比较版本号大小
    :param version1: v1
    :param version2: v2
    :return:
        0: v1 == v2
      >=1: v1 > v2
      <=0: v1 < v2
    """

    def parse_version(version):
        parts = re.split(r'(\d+)', version)  # 按照数字分割
        return [p for p in parts if p]  # 去除空字符串

    v1_parts = parse_version(version1)
    v2_parts = parse_version(version2)

    min_length = min(len(v1_parts), len(v2_parts))

    for i in range(min_length):
        part1 = v1_parts[i]
        part2 = v2_parts[i]

        if part1.isdigit() and part2.isdigit():
            # 如果都是数字，直接比较数值
            if int(part1) != int(part2):
                return int(part1) - int(part2)
        else:
            # 如果是字符串，比较字母顺序
            if part1 != part2:
                if part1 < part2:
                    return -1
                else:
                    return 1

    # 如果前面部分都相等，比较长度
    if len(v1_parts) != len(v2_parts):
        return len(v1_parts) - len(v2_parts)

    return 0  # 完全相等
